import java.sql.Timestamp;

public abstract class Comment {
    private int id;
    private String content;
    private User user;
    private Timestamp timestamp;
    private int likeCount;
    private int musicId;

    public Comment(int id, String content, User user, Timestamp timestamp) {
        this.id = id;
        this.content = content;
        this.user = user;
        this.timestamp = timestamp;
    }

    public void like(){
        likeCount++;
    };

    public void unlike(){
        likeCount--;
    }

    public void display(){
        System.out.println(toString());
    }

    @java.lang.Override
    public java.lang.String toString() {
        return  "id: " + id +
                ", 由用户 ' " + user.getNickname() +
                " '  发表的评论，内容为：" + content + '\'' +
                ", 发表时间：" + timestamp +
                ", 点赞数：" + likeCount;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getUserId() {
        return user.getId();
    }

    public String getUserNickname() {
        return user.getNickname();
    }

    public Timestamp getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Timestamp timestamp) {
        this.timestamp = timestamp;
    }

    public int getLikeCount() {
        return likeCount;
    }

    public void setLikeCount(int likeCount) {
        this.likeCount = likeCount;
    }

    public int getMusicId() { return this.musicId; }

    public void setMusicId(int musicId) { this.musicId = musicId; }


}